<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ko" xml:lang="ko">

<head>
	<title></title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<%@page import = "java.util.*,java.text.*"%>
	<link rel="stylesheet" type="text/css" href="../css/base.css" media="all" />
<script type="text/javascript">
function doValidate1(){
	document.form1.submit();
	return true;
}
function loginChk(){
	alert("not login");
	location.href("../mkt/main");
	return false;
}
</script>
</head>
<body id="wrap_bg">
<div id="accessibility">
	<h1 class="hidden"><a href="/">logo</a></h1>
</div>
<div id="wrap">
	<h2 class="hidden">main_menu</h2>
	<div id="container">
		<!-- left-->		
	    <h2 class="hidden">sub_menu</h2>
		<div id="left_part">
			<div id="left_menu"></div>
		</div>
	    <h2 class="hidden">contacts</h2>
		<div id="body_part">
			<div id="body_con">
<%
	if(request.getParameter("id") == null){
		out.println("<script>loginChk()</script>");
	}
	String id = request.getParameter("id");
	
	String connectionUrl = "jdbc:sqlserver://bizring.biz:14333;databaseName=bizring";
	String userid = "sa";
	String passwd = "qlalf@sql";
	
	// Declare the JDBC objects.
	java.sql.Connection con = null;
	java.sql.Statement stmt = null;
	java.sql.Statement stmt2 = null;
	java.sql.Statement stmt3 = null;
	java.sql.ResultSet rs = null;
	java.sql.ResultSet rs2 = null;
	java.sql.ResultSet rs3 = null;

	// Establish the connection.
	Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
	
%>	
			<p class="title" style="padding:72px 0 16px;"><a href="./price_advertiser.html?id=<%=id%>"><img src="../images/3s/bizring.jpg" alt="bizring" width="110" height="40"/></a>
			&nbsp;&nbsp;&nbsp;<img src="../images/3s/sss.jpg" alt="bizring" width="110" height="20"/>
				<div class="ta_top"></div>
				<div class="ta_bg">
					<div class="bs_con">
<%
	try {   
		// Create and execute an SQL statement that returns some data.
		String SQL = "select company, seller_name, seller_no, type, seller_address, seller_tel, seller_fax, dayprice, convert(varchar,input_date,106) as input_date	" + 
					 "  from seller																																		" + 
					 " where id = " + id																																;
		
		String SQL2 = "select c.name, c.position, c.hp1, c.hp2, c.email		" + 
					  "from seller as s, seller_contact as c				" +
					  "where s.id = c.seller_id								" +
			  		  "and s.id = " + id						    		;
		
		String SQL3 = "select c.name, c.tel, c.hp, c.email			" + 
					  "from seller as s, seller_staff as c			" +
					  "where s.staff_id = c.id						" +
					  "and s.id = " + id						    ;
		
		con = java.sql.DriverManager.getConnection(connectionUrl, userid, passwd);
		stmt = con.createStatement();
		rs = stmt.executeQuery(SQL);
		stmt2 = con.createStatement();
		rs2 = stmt2.executeQuery(SQL2);
		stmt3 = con.createStatement();
		rs3 = stmt3.executeQuery(SQL3);
		
		rs.next();
		
		String company = rs.getString("company");
		String sellerName = rs.getString("seller_name");
		String sellerNo = rs.getString("seller_no");
		String type = rs.getString("type");
		String sellerAddress = rs.getString("seller_address");
		String sellerTel = rs.getString("seller_tel");
		String sellerFax = rs.getString("seller_fax");
		String dayPrice = rs.getString("dayPrice");
		String inputDate = rs.getString("input_Date");
		
%>
		<table align="right">
			<tr>
				<td align="right" colspan="5"><span style='font-size:9.0pt;text-align:right;'>Registered : <%=inputDate%></span></td>
			</tr>
			<table class="board03">
		<tr>
			<td colspan="2" height="10px" class="line"></td>
		</tr>
		</table>
		</table>
		<br/><br/>
		<table>
			<tr>
				<td style="padding:0px 0px 15px 0px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='font-size:10.0pt;text-align:center;color:black'><strong>seller Name&nbsp;&nbsp;:&nbsp;&nbsp;</strong><%=company%></span>&nbsp;&nbsp;&nbsp;&nbsp;</td>
				<td style="padding:0px 0px 15px 0px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
				<td style="padding:0px 0px 15px 0px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='font-size:10.0pt;text-align:center;color:black'><strong>Seller Code&nbsp;&nbsp;:&nbsp;&nbsp;</strong><%=sellerNo%></span>&nbsp;&nbsp;&nbsp;&nbsp;</td>
				<td style="padding:0px 0px 15px 0px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
				<td style="padding:0px 0px 15px 0px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='font-size:10.0pt;text-align:center;color:black'><strong>Type&nbsp;&nbsp;:&nbsp;&nbsp;</strong><%=type%></span></td>
			</tr>
			<tr>
				<td colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='font-size:10.0pt;text-align:center;'><%=sellerAddress%></span></td>
				<td colspan="3" align="right"><span style='font-size:10.0pt;text-align:center;'>Tel. <%=sellerTel%>&nbsp;&nbsp;&nbsp;Fax. <%=sellerFax%></span></td>
			</tr>
		</table>
		
		<form action="./price_estimation.html" name="form1" method="post">
			<input type="hidden" name="id" id="id" value="<%=id%>" size="0"></input>
			<input type="hidden" name="dayprice" id="dayprice" value="<%=rs.getString("dayprice") %>" size="0"></input>
			<input type="hidden" name="company" id="company" value="<%=rs.getString("company")%>" size="0"></input>
			<input type="hidden" name="input_date" id="input_date" value="<%=inputDate%>" size="0"></input>
		</form>
		<br/>
		<table class="board01" bgcolor="#DCDCDC">
			<tr>
				<td align="left" colspan="5" style="padding:0px 0px 0px 0px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='font-size:11.0pt;text-align:center;color:black'><strong>Contact</strong></span></td>
			</tr>
			<tbody><td colspan="5" height="5px" class="line"></td></tbody>
<% while(rs2.next()){%>
			<tr>
				<td><span style='font-size:10.0pt;text-align:center;'><%=rs2.getString("name")%></span></td>
				<td><span style='font-size:10.0pt;text-align:center;'><%=rs2.getString("position")%></span></td>
				<td><span style='font-size:10.0pt;text-align:center;'><%=rs2.getString("hp1")%></span></td>
				<td><span style='font-size:10.0pt;text-align:center;'><%=rs2.getString("hp2")%></span></td>
				<td><span style='font-size:10.0pt;text-align:center;'><%=rs2.getString("email")%></span></td>
			</tr>
<%} %>		
			<tbody><td colspan="5" height="5px" class="line"></td></tbody>
			<tr>
				<td colspon=5 style="padding:0px 0px 10px 0px"></td>
			</tr>
		</table>
<%rs3.next();%>
		<div class="clear" style="padding-top:15px;text-align:left;">
		<span style='font-size:10.0pt;text-align:center;'>Your staff is <strong><%=rs3.getString("name") %></strong> ( <%=rs3.getString("tel") %> / <%=rs3.getString("hp") %> / <%=rs3.getString("email") %> )</span></div>
		<div class="clear" style="padding-top:15px;text-align:left;">
		<a href="#" onclick="doValidate1()"><img src="../images/3s/estimation.jpg" alt="send" align="absmiddle" width="80" height="30"></a>
		<a href="#" onclick=""><img src="../images/3s/chkavailable.jpg" alt="send" align="absmiddle" width="80" height="30"></a>
		<a href="#" onclick=""><img src="../images/3s/download.jpg" alt="send" align="absmiddle" width="80" height="30"></a>
		<a href="#" onclick=""><img src="../images/3s/faq.jpg" alt="send" align="absmiddle" width="80" height="30"></a>
		<a href="#" onclick=""><img src="../images/3s/qna.jpg" alt="send" align="absmiddle" width="80" height="30"></a>
		<a href="#" onclick=""><img src="../images/3s/adschedule.jpg" alt="send" align="absmiddle" width="80" height="30"></a>
		<a href="#" onclick=""><img src="../images/3s/checkreport.jpg" alt="send" align="absmiddle" width="80" height="30"></a></div>
<%
	} catch (java.sql.SQLException e) {   
	    e.printStackTrace();  
	} finally{   
	    try {   
	        if(stmt !=null) stmt.close();  
	        if(stmt2 !=null) stmt2.close();
	        if(con !=null) con.close();   
	    } catch (java.sql.SQLException e) {   
	        e.printStackTrace();   
	    }   
	}  
	
%>	
					<br/></br>
					<table>
								<tr>
									<td align="right" colspan="5">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='font-size:11.0pt;text-align:right;color:#800000;'><strong>Notice</strong></span></td>
								</tr>
					</table>
					<br/>			
					<table class="board03" cellpadding="0" cellspacing="0" border="0" summary="notice_list">
							<caption style="position:absolute; width:0; height:0; font-size:0; line-height:0; overflow:hidden; visibility:hidden;">notice_list</caption>
							<colgroup>
								<col style="width:220px" />
							</colgroup>
							<thead>
								<tr>
									<th scope="col"><img src="../images/biz-ring/board_title02.gif" alt="Title" align="absmiddle" /></th>
									<th scope="col"><img src="../images/biz-ring/board_title01.gif" alt="Date" align="absmiddle" /></th>
								</tr>
							</thead>
								<tr>
									<tbody><td colspan="5" height="5px" class="line"></td>
								</tr>
<%
	int rows = 12;
	int currPage = (request.getParameter("page") == null ? 1 : 
						request.getParameter("page").equals("0") ? 1 : Integer.parseInt(request.getParameter("page")));
	
	// Establish the connection.
	Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

	try {   
		// Create and execute an SQL statement that returns some data.
		String SQL = "SELECT CONVERT(varchar, input_date, 106) as input_date, title, id as row_id, RowNum FROM " +
					 "( SELECT n.input_date, n.title, n.id, ROW_NUMBER() OVER (ORDER BY id desc) AS RowNum " +
			     	 "FROM seller_notice as n ) AS MyDerivedTable WHERE MyDerivedTable.RowNum BETWEEN " + 
			     	 (rows * (currPage - 1) + 1) + " AND " + (rows * currPage);
		
		
		con = java.sql.DriverManager.getConnection(connectionUrl, userid, passwd);
		stmt = con.createStatement();
		rs = stmt.executeQuery(SQL);
		int displayedRow = 0;
		
		// Iterate through the data in the result set and display it.
		while (rs.next()) {
			displayedRow++;
			out.println("<tr>");
			out.println("<td class=\"title\"><a href=\"advertiser_read.jsp?id=" + id + "&rowid=" + rs.getString("row_id") + "\">" + rs.getString("title") + "</a></td>");
			out.println("<td class=\"date\">" + rs.getString("input_date") + "</td>");
			out.print("</tr>");
		}
		for (int i = displayedRow; i < 12; i++)
			out.println("<tr><td class=\"date\"></td><td class=\"title\"></td></tr>");
    } catch (java.sql.SQLException e) {   
        e.printStackTrace();   
    } finally{   
        try {   
            if(stmt !=null) stmt.close();   
            if(con !=null) con.close();   
        } catch (java.sql.SQLException e) {   
            e.printStackTrace();   
        }   
    }   
%>
								<tr>
									<td colspan="2" height="10px" class="line"></td>
								</tr>
							</tbody>
						</table>
<div class="board_navigation">
<%
	
	try {
		String counter = "SELECT count(1) as counter FROM seller_notice";
		con = java.sql.DriverManager.getConnection(connectionUrl, userid, passwd);
		stmt = con.createStatement();
		rs = stmt.executeQuery(counter);
		int totalRecode = 0;
		while (rs.next()) {
			totalRecode = rs.getInt(1);
		}
		
		int totalPage = (int)(Math.ceil((double)totalRecode/rows));
		int viewFirst = ((int)(currPage-1)/10) * 10;
		int viewLast = ((int)(currPage-1)/10) * 10 + 9;
		
		String href = "";
	
			if(viewFirst != 0){
				out.print("<a href=\"./price_advertiser.html?admin=administrator3k&page=1\"><b>[First]</b></a>&nbsp;&nbsp; ");
				out.print("<a href=\"./price_advertiser.html?admin=administrator3k&page=" + viewFirst + "\"><b>[Prev]</b></a>&nbsp;&nbsp; ");
			}
			
			for (int i = 0;i < totalPage; i++){						
				if (i == (currPage - 1)){
					href = "<span class=\"text_red\">" + (i + 1) + "</span>&nbsp;";
					out.print(href + " ");
				}
				else if( (i >= viewFirst) && (i <= viewLast) ){			
					href = "<a href=\"./price_advertiser.html?admin=administrator3k&id=" + id + "&page=" + (i + 1) + "\">" + (i + 1) + "</a>&nbsp;&nbsp;";
					out.print(href + " ");
				}
			}
			
			if( (int)viewLast/10 != (int)totalPage/10){
				out.print("&nbsp;&nbsp;<a href=\"./price_advertiser.html?admin=administrator3k&page=" + (viewLast + 2) + "\"><b>[Next]</b></a>");
				out.print("&nbsp;&nbsp;<a href=\"./price_advertiser.html?admin=administrator3k&page=" + totalPage + "\"><b>[Last]</b></a> ");
			}
		
	} catch (java.sql.SQLException e) {
		e.printStackTrace();
	} finally {
		try {   
            if(stmt !=null) stmt.close();   
            if(con !=null) con.close();   
        } catch (java.sql.SQLException e) {   
            e.printStackTrace();   
        }
	}
	
	
		
%>	
					</div>				
					</div>					
				</div>
				<div class="ta_bot"></div>
			</div>		
		</div>
	</div>

	<h2 class="hidden">copyright</h2>
	<div id="foot">
		<div id="foot_part">
			<p id="line_solid"></p>
			<div class="foot_adress">
				<ul>
					<li class="logo"><img src="../images/common/tsellogo.png" alt="Powered by TELKOMSEL" /></li>
					<li class="address">
						<div class="f_address">
							<address>
							<img src="../images/common/copyright.gif" alt="This site is The Telkomsel Small Ring Service website.   /   BizRing Operator : PT. Kami Kaya Kreasi
Address : Jl. Daksa IV, No. 69, Kebayoran Baru, Jakarta Selatan - 12110 Indonesia
Tel +62 21 723 5038  Fax +62 21 723 5037  info@kamikayakreasi.com
wwww.kamikayakreasi.com" />
							</address>					
						</div>
					</li>
				</ul>
			</div>	
		</div>
	</div>
 
</div>
</BODY>
</HTML>
